﻿using DataAccess;
using System.Data;
using Entity;

namespace Business
{
    public class UsersBus
    {
        private UserDao _userDao;

        public bool CheckUserLogOn(string userName,string password)
        {
            _userDao = new UserDao();
            int result = _userDao.CheckUserLogOn(userName, password);
            return (result != 0);
        }
        public bool CheckUserIsExists(string userName)
        {
            _userDao = new UserDao();
            int result = _userDao.CheckUserIsExists(userName);
            return (result != 0);
        }

        public DataSet GetUserByUserName(string userName)
        {
            _userDao = new UserDao();
            return _userDao.SelectUsersByUserName(userName);
        }

        public DataSet SelectAllUser()
        {
            _userDao = new UserDao();
            return _userDao.SelectAllUser();
        }

        public bool UpdateUser(User user)
        {
            _userDao = new UserDao();
            int result = _userDao.UpdateUser(user);
            return (result != 0);
        }
        public bool AddUser(User user)
        {
            _userDao = new UserDao();
            int result = _userDao.AddUser(user);
            return (result != 0);
        }

        public bool DeleteUser(string userName)
        {
            _userDao = new UserDao();
            int result = _userDao.DeleteUser(userName);
            return (result != 0);
        }
    }
}
